home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tttdem51.zip / KEYDEM1.PAS < prev    next >
Pascal/Delphi Source File  |  1989-01-31  |  1KB  |  43 lines

  1. Program KeyTTT5_Demo_1;
  2. {demostrates the use of user hooks}
  3.  
  4. Uses CRT, FASTTTT5, KeyTTT5, StrnTTT5, MiscTTT5;
  5.  
  6. var Ch : char;
  7.  
  8. Procedure Halt_program;
  9. {this procedure will be called by the pressed-hook procedure when F10 is pressed}
  10. begin
  11.     ClearText(1,1,80,25,white,black);
  12.     WriteAT(1,1,white,black,'Run DemoTTT.exe for the main demo program');
  13.     WriteAT(1,2,white,black,'Technojock''s Turbo Toolkit v5.0');
  14.     GotoXY(1,5);
  15.     Halt;
  16. end;
  17.  
  18. {$F+}                {VERY IMPORTANT must make procedures "FAR"}
  19. Procedure Show_Clock;
  20. begin
  21.     WriteAt(65,1,white,red,' '+Time+' ');
  22. end;
  23.  
  24. Procedure Check_Pressed_Keys(var Ch : char);
  25. begin
  26.     If Ch = #196 then    {F10}
  27.        Halt_program;
  28. end;
  29. {$F-}
  30.  
  31. begin
  32.     FBox(1,1,80,25,white,red,2);
  33.     WriteCenter(1,yellow,red,' Key Hooks Demo - TTT 5.0 ');
  34.     WriteCenter(25,lightgray,red,' Press any key, or F10 to exit ');
  35.     WriteAt(15,13,white,red,'The Toolkit value of the pressed key is ');
  36.     Assign_Pressed_Hook(Check_Pressed_keys);
  37.     Assign_Idle_Hook(Show_Clock);
  38.     Repeat
  39.          Ch := GetKey;
  40.          WriteAt(55,13,yellow,red,Int_to_Str(Ord(Ch))+'  ');
  41.     Until true = false;   {a long time!};
  42. end.
  43.